package net.huashitong.Project.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.core.entity.BaseEntity;
import com.sirdc.modules.sys.base.StringPKService;
import net.huashitong.Project.dao.InvestCatalogDao;
import net.huashitong.Project.entity.NewProjects;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class InvestCatalogService extends StringPKService {
    @Autowired
    private InvestCatalogDao dao;
    @Override
    protected BaseDao getDao() {
        return null;
    }

    @Override
    protected void onPreUpdate(BaseEntity baseEntity) {

    }

    @Override
    protected void onPrePersist(BaseEntity baseEntity) {

    }
    public Map queryInvestCatalog(){
        List<NewProjects> news = dao.query();
        int zfsz = 0;
        int zfsl = 0;
        int qytz = 0;
        int tdsc=0;
        for(NewProjects newProject:news){
            if("1".equals(newProject.getNatureType())){
                zfsz+=1;
            }
            if("2".equals(newProject.getNatureType())){
                zfsl+=1;
            }
            if("3".equals(newProject.getNatureType())){
                qytz+=1;
            }
            if("4".equals(newProject.getNatureType())){
                tdsc+=1;
            }
        }
        Map map=new HashMap();
        map.put("zfsz",zfsz);
        map.put("zfsl",zfsl);
        map.put("qytz",qytz);
        map.put("tdsc",tdsc);
        return map;
    }
}
